<template>
  <div class="tong_ji">
    <el-row class="information">
      <el-col :span="8"><div class="grid-content bg-purple-l" style="background:#00ff00;">
        <span>今日接收消息数量</span>
        <span>11520</span>
      </div></el-col>
      <el-col :span="8"><div class="grid-content bg-purple-c" style="background:#009900;">
        <span>今日接收消息数量</span>
        <span>11520</span>
      </div></el-col>
      <el-col :span="8"><div class="grid-content bg-purple-r" style="background:#006666;">
        <span>今日接收消息数量</span>
        <span>95%</span>
      </div></el-col>
    </el-row>
    <el-row class="tu_yuan">
      <el-col :span="12">
        <div class="grid-content bg-purple" id="Access" style="width:100%;height:350px;">
        </div>
        <div class="title">设备接入数量图</div>
    </el-col>

      <el-col :span="12"><div class="grid-content bg-purple-light" id="distribution" style="width: 100%;height:350px;"></div>
        <div class="title">设备分布图</div>
      </el-col>
    </el-row>
 
  </div>
</template>
<style scoped>
  .tong_ji{
   
  }
  .tong_ji .information{
    height: 100px;
    /*background: red;*/
    text-align: center;
  }
  .tong_ji .information .grid-content{
    height: 100px;
    line-height: 100px;
    width: 80%;
    margin: 0 auto;
  }
  .tong_ji .information .grid-content .bg-purple-c{
    background: #000;
  }
  .tong_ji .tu_yuan .grid-content{
    margin: 0 auto;
  }
  .tong_ji .tu_yuan .title{
    width: 100%;
    margin: 0 auto;
    text-align: center;
  }
</style>

<script>
import  echarts from 'echarts';
export default {
	name: 'Rule',
	data() {
		return {
        
		};
	},
	created(){
	},
	methods: {

	},
	mounted:function () {
		
		//基于准备好的dom，初始化echarts实例
		// 设备接入
		this.Access = echarts.init(document.getElementById('Access'));
		this.Access.setOption({
			tooltip: {
				trigger: 'item',
				formatter: "{a} <br/>{b}: {c} ({d}%)"
			},
			series: [
				{
					name:'访问来源',
					type:'pie',
					selectedMode: 'single',
					radius: [0, '70%'],

					label: {
						normal: {
							position: 'inner'
						}
					},
					labelLine: {
						normal: {
							show: false
						}
					},
					data:[
						{value:25, name:'未接入数量'},
						{value:75, name:'已接入数量'}
					]
				},
				{
					name:'访问来源',
					type:'pie',
					radius: ['40%', '55%'],
					label: {
						normal: {
							formatter: '{a|{a}}{abg|}\n{hr|}\n  {b|{b}：}{c}  {per|{d}%}  ',
							backgroundColor: '#eee',
							borderColor: '#aaa',
							borderWidth: 1,
							borderRadius: 4,
                       
							rich: {
								a: {
									color: '#999',
									lineHeight: 22,
									align: 'center'
								},
								hr: {
									borderColor: '#aaa',
									width: '100%',
									borderWidth: 0.5,
									height: 0
								},
								b: {
									fontSize: 16,
									lineHeight: 33
								},
								per: {
									color: '#eee',
									backgroundColor: '#334455',
									padding: [2, 4],
									borderRadius: 2
								}
							}
						}
					}
                
				}
			]
		});

		// 设备分布
		this.distribution = echarts.init(document.getElementById('distribution'));
		this.distribution.setOption({
			tooltip: {
				trigger: 'item',
				formatter: "{a} <br/>{b}: {c} ({d}%)"
			},
			series: [
				{
					name:'访问来源',
					type:'pie',
					selectedMode: 'single',
					radius: [0, '70%'],

					label: {
						normal: {
							position: 'inner'
						}
					},
					labelLine: {
						normal: {
							show: false
						}
					},
					data:[
						{value:25, name:'风力发电机'},
						{value:15, name:'水利发电机'},
						{value:30, name:'变电站'},
						{value:30, name:'高压电塔'}
					]
				},
				{
					name:'访问来源',
					type:'pie',
					radius: ['40%', '55%'],
					label: {
						normal: {
							formatter: '{a|{a}}{abg|}\n{hr|}\n  {b|{b}：}{c}  {per|{d}%}  ',
							backgroundColor: '#eee',
							borderColor: '#aaa',
							borderWidth: 1,
							borderRadius: 4,
                       
							rich: {
								a: {
									color: '#999',
									lineHeight: 22,
									align: 'center'
								},
								hr: {
									borderColor: '#aaa',
									width: '100%',
									borderWidth: 0.5,
									height: 0
								},
								b: {
									fontSize: 16,
									lineHeight: 33
								},
								per: {
									color: '#eee',
									backgroundColor: '#334455',
									padding: [2, 4],
									borderRadius: 2
								}
							}
						}
					}
                
				}
			]
		});
	}   
};
</script>